Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wswitch warning (encountered on GCC - might also apply to CLang) #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CristiFati
Copy link

@CristiFati CristiFati commented Oct 24, 2023

Including (recursively by other files (cudaOverlay.h)) imageFormat.inl, generates (annoying) compiler warnings:

.../jetson_utils/image/imageFormat.inl: In function 'const char* imageFormatToStr(imageFormat)':
.../jetson_utils/image/imageFormat.inl:33:8: warning: enumeration value 'IMAGE_COUNT' not handled in switch [-Wswitch]
   33 |  switch(format)
      |        ^
.../jetson_utils/image/imageFormat.inl: In function 'imageBaseType imageFormatBaseType(imageFormat)':
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_RGB8' not handled in switch [-Wswitch]
  142 |  switch(format)
      |        ^
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_RGBA8' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BGR8' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BGRA8' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_YUYV' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_YUY2' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_YVYU' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_UYVY' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_I420' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_YV12' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_NV12' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BAYER_BGGR' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BAYER_GBRG' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BAYER_GRBG' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_BAYER_RGGB' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_GRAY8' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_COUNT' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl:142:8: warning: enumeration value 'IMAGE_UNKNOWN' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl: In function 'size_t imageFormatChannels(imageFormat)':
.../jetson_utils/image/imageFormat.inl:158:8: warning: enumeration value 'IMAGE_COUNT' not handled in switch [-Wswitch]
  158 |  switch(format)
      |        ^
.../jetson_utils/image/imageFormat.inl:158:8: warning: enumeration value 'IMAGE_UNKNOWN' not handled in switch [-Wswitch]
.../jetson_utils/image/imageFormat.inl: In function 'size_t imageFormatDepth(imageFormat)':
.../jetson_utils/image/imageFormat.inl:189:8: warning: enumeration value 'IMAGE_COUNT' not handled in switch [-Wswitch]
  189 |  switch(format)
      |        ^
.../jetson_utils/image/imageFormat.inl:189:8: warning: enumeration value 'IMAGE_UNKNOWN' not handled in switch [-Wswitch]

Fix (without affecting the behavior).

P.S.: Not a very big fan of the code style (all those TABs), but kept consistency.

@CristiFati CristiFati changed the title fix -Wswitch (encountered on GCC - might also apply to CLang) Fix -Wswitch warning (encountered on GCC - might also apply to CLang) Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant